This PR is to add comments to TestSyncMetadataInternal in pkg/ddc/efc/metadata_test.go#5785
This PR is to add comments to TestSyncMetadataInternal in pkg/ddc/efc/metadata_test.go#5785ZzzRemake wants to merge 1 commit intofluid-cloudnative:masterfrom
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @ZzzRemake. Thanks for your PR. I'm waiting for a fluid-cloudnative member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
There was a problem hiding this comment.
Code Review
This pull request adds documentation comments to the TestSyncMetadataInternal function in pkg/ddc/efc/metadata_test.go to outline the various test scenarios covered. The reviewer suggests refactoring the test suite to utilize Go subtests (t.Run) for improved readability and more granular failure reporting.
| // TestSyncMetadataInternal tests the syncMetadataInternal method of EFCEngine. | ||
| // It verifies the method's behavior under different scenarios: | ||
| // 1. When TotalStorageBytes returns an error | ||
| // 2. When TotalFileNums returns an error | ||
| // 3. When both TotalStorageBytes and TotalFileNums succeed |
There was a problem hiding this comment.
This comment accurately describes the different scenarios this test covers. To improve the test's structure, readability, and maintainability, consider refactoring it to use subtests with t.Run for each scenario. This provides clearer output on failures and makes the test structure more explicit.
For example:
func TestSyncMetadataInternal(t *testing.T) {
// ... setup ...
t.Run("TotalStorageBytes returns an error", func(t *testing.T) {
// ... test logic for this case ...
})
t.Run("TotalFileNums returns an error", func(t *testing.T) {
// ... test logic for this case ...
})
t.Run("Both succeed", func(t *testing.T) {
// ... test logic for this case ...
})
}|
The DCO check is failing on this PR. Please ensure your commit includes a |
….go. Signed-off-by: ZzzRemake <remake114514@outlook.com>
f78154e to
7c12b66
Compare
|



Ⅰ. Describe what this PR does
This PR is to add comments to TestSyncMetadataInternal in pkg/ddc/efc/metadata_test.go.
Ⅱ. Does this pull request fix one issue?
fixes #5784
Ⅲ. Special notes for reviews